﻿using Quartz;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace S2_Xxxx_XxxNetApi
{
    [DisallowConcurrentExecution]
    /// <summary>
    /// 测试 job
    /// </summary>
    public class TaskExcute : BaseJob
    {
        public TaskExcute() : base("TestJob", "TestTrigger", "TestGrop", 2) { }
        public override Task Execute(IJobExecutionContext context)
        {
            try
            {
                return Task.Run(() =>
             {
                 using (StreamWriter sw = new StreamWriter(@"C:\Job\error.log", true, Encoding.UTF8))
                 {
                     sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));
                 }
             });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

